package utgame.com.contentpriverderdemo;


import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.util.ArrayList;
import java.util.List;


public class ContentProviderActivity extends AppCompatActivity implements View.OnClickListener{

    private List<Button> mBtnList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_content_provider);

        initView();
    }


    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.btn_call_log){
            ContentProviderExample.getCallHistoryList(this, 100);
        } else if (id == R.id.btn_sms_log){
            ContentProviderExample.getSmsLog(this);
        } else if (id == R.id.btn_contacts){
            ContentProviderExample.getContacts(this, true);
        }
    }

    private void initView(){
        mBtnList.add((Button)findViewById(R.id.btn_call_log));
        mBtnList.add((Button)findViewById(R.id.btn_sms_log));
        mBtnList.add((Button)findViewById(R.id.btn_contacts));

        for (Button btn : mBtnList){
            btn.setOnClickListener(this);
        }
    }

}
